from rest_framework.serializers import ModelSerializer
from .models import Banner,Nav

#轮播图序列化器
class BannerSerializer(ModelSerializer):
    class Meta:
        model=Banner                               #指定模型类
        fields=['image_url','link']                #因为前端只需要一个链接和展示的图片，方便前端进行展示


class NavSerializer(ModelSerializer):
    #导航菜单序列化器
    class Meta:
        model=Nav
        fields=['title','link','is_site']
